import Cookies from "js-cookie";

const TokenKey = "X-ZUEL-IHNM-Token";

export function getToken() {
  return Cookies.get(TokenKey);
}

export function setToken(token) {
  return Cookies.set(TokenKey, token);
}

export function removeToken() {
  return Cookies.remove(TokenKey);
}

export function setUser(info) {
  return Cookies.set("userInfo", JSON.stringify(info));
}

export function getUser() {
  if (Cookies.get("userInfo")) {
    return JSON.parse(Cookies.get("userInfo"));
  } else {
    return "";
  }
}

export function setSession(status) {
  return window.sessionStorage.setItem("isLogin", status);
}
export function getSession() {
  return window.sessionStorage.getItem("isLogin");
}

export function setClassSession(id) {
  return window.sessionStorage.setItem("classId", id);
}
export function getClassSession() {
  return window.sessionStorage.getItem("classId");
}
